package com.lrkj.workorder.service.impl;

import java.util.List;
import com.lrkj.common.utils.DateUtils;
import com.lrkj.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.lrkj.workorder.mapper.WorkOrderTypeMapper;
import com.lrkj.workorder.domain.WorkOrderType;
import com.lrkj.workorder.service.IWorkOrderTypeService;

/**
 * 工单类型Service业务层处理
 *
 * @author yajun_ren
 * @date 2022-04-19
 */
@Service
public class WorkOrderTypeServiceImpl implements IWorkOrderTypeService
{
    @Autowired
    private WorkOrderTypeMapper workOrderTypeMapper;

    /**
     * 查询工单类型
     *
     * @param id 工单类型ID
     * @return 工单类型
     */
    @Override
    public WorkOrderType selectWorkOrderTypeById(String id)
    {
        return workOrderTypeMapper.selectWorkOrderTypeById(id);
    }

    /**
     * 查询工单类型列表
     *
     * @param workOrderType 工单类型
     * @return 工单类型
     */
    @Override
    public List<WorkOrderType> selectWorkOrderTypeList(WorkOrderType workOrderType)
    {
        return workOrderTypeMapper.selectWorkOrderTypeList(workOrderType);
    }

    /**
     * 新增工单类型
     *
     * @param workOrderType 工单类型
     * @return 结果
     */
    @Override
    public int insertWorkOrderType(WorkOrderType workOrderType)
    {
        workOrderType.setId(IdUtils.simpleUUID());
        workOrderType.setCreateTime(DateUtils.getNowDate());
        return workOrderTypeMapper.insertWorkOrderType(workOrderType);
    }

    /**
     * 修改工单类型
     *
     * @param workOrderType 工单类型
     * @return 结果
     */
    @Override
    public int updateWorkOrderType(WorkOrderType workOrderType)
    {
        workOrderType.setUpdateTime(DateUtils.getNowDate());
        return workOrderTypeMapper.updateWorkOrderType(workOrderType);
    }

    /**
     * 批量删除工单类型
     *
     * @param ids 需要删除的工单类型ID
     * @return 结果
     */
    @Override
    public int deleteWorkOrderTypeByIds(String[] ids)
    {
        return workOrderTypeMapper.deleteWorkOrderTypeByIds(ids);
    }

    /**
     * 删除工单类型信息
     *
     * @param id 工单类型ID
     * @return 结果
     */
    @Override
    public int deleteWorkOrderTypeById(String id)
    {
        return workOrderTypeMapper.deleteWorkOrderTypeById(id);
    }
    /**
     * 批量新增工单类型信息
     *
     * @param workOrderTypes 工单类型对象
     */
    public int batchAddData(List<WorkOrderType> workOrderTypes)
    {
           return workOrderTypeMapper.batchAddData(workOrderTypes);
    }
}
